# DEFAULT SERVER SETTINGS
# -----------------------------------------------------------------------------
# All default server side settings for the app are set on this file.
# Please DO NOT CHANGE ANYTHING HERE, unless you know what you're doing.
# Your own settings should be specified / overriden on the `settings.coffee` file.

class SettingsDefault

    # GENERAL
    # -------------------------------------------------------------------------
    General:
        # Enable or disable debugging messages. Should be false on production environments.
        debug: false
        # The app title.
        appTitle: "Counting.to"
        # The app's base URL, including http://.
        appUrl: "http://counting.to"
        # Default ISO date format to be used by Moment.js (server side).
        isoDateFormat: "YYYY-MM-DD HH:mm:ss Z"
        # The default text to show on top of pages.
        pageHeader: "Counting.t"

    # PATHS
    # -------------------------------------------------------------------------
    Path:
        # Path to the email templates folder.
        emailTemplatesDir: "./server/emailtemplate/"
        # Path to the public folder used by Express.
        publicDir: "./public/"
        # Path where the .jade views are stored.
        viewsDir: "./views/"

    # WEB
    # -------------------------------------------------------------------------
    Web:
        # Secret key used for cookie encryption.
        cookieSecret: "Counting.to.Cookie"
        # Node.js server IP. Leaving blank or null will set the server to listen on all addresses.
        # This value might be overriden by PaaS environmental values.
        ip: null
        # Having paas set to `true` will force the app to parse and use environment variables.
        # Set to true if you're running this app on AppFog, Nodejitsu, OpenShift etc.
        paas: true
        # Node.js server port. Please note that this value might be overriden by PaaS
        # environmental values (like in AppFog or OpenShift).
        port: 3456
        # Secret key used for session encryption.
        sessionSecret: "Counting.to.Session"

    # CONNECT ASSETS
    # -------------------------------------------------------------------------
    ConnectAssets:
        # Build single assets?
        build: true
        # Build directories?
        buildDir: false
        # Minify JS and CSS builds?
        minifyBuilds: true

    # ERROR HANDLING
    # -------------------------------------------------------------------------
    ErrorHandling:
        # Dump exceptions? On production environments we recommend setting this to false.
        dumpExceptions: false
        # Show stack trace? On production environments we recommend setting this to false.
        showStack: false

    # DATABASE
    # ----------------------------------------------------------------------
    Database:
        # Connection string to MongoDB, using the format `user:password@hostname/dbname`.
        # Default is database countingto, running on localhost, with no credentials.
        connString: "mongodb://localhost/countingto"
        # In case you don't have failover / sharding in place on the database above
        # using MongoDB built-in features, you can set a failover connection string below.
        # It will be used ONLY if connection to the main database fails repeatedly.
        connString2: null
        # How long to wait before trying to connect to the main database again (in seconds).
        failoverTimeout: 300
        # How many retries before switching to the failover database or aborting a database operation.
        maxRetries: 3
        # How long between connection retries, in milliseconds. Default is 5 seconds.
        retryInterval: 5000
        # Database connection options.
        options:
            # Auto recconect if connection is lost?
            autoReconnect: true
            # Default pool size for connections.
            poolSize: 8
            # Safe writes? Setting this to true makes sure that Mongo aknowledges disk writes.
            safe: false

    # EMAIL
    # -------------------------------------------------------------------------
    Email:
        # Default `from` email address.
        from: null
        # The SMTP host. If set to null or blank, no emails will be sent out.
        smtpHost: null
        # The SMTP auth password.
        smtpPassword: null
        # The SMTP port to connect to.
        smtpPort: null
        # Connect using SSL? If you're using prt 587 then secure must be set to false in most cases.
        smtpSecure: false
        # The SMTP auth username.
        smtpUser: null

    # LOGGING
    # -------------------------------------------------------------------------
    # Built-in support for Loggly and Logentries. Define which service to use
    # by setting the `service` to either "loggly" or "logentries". Leave it
    # null to disable general logging.
    # Tip: if you're using AppFog, you can easily create a Logentries account
    # by going to the "Add-on" tabs.
    Log:
        # If `sendIP` is true, the IP address of the machine will be added to logs events.
        # Useful when you have different instances of the app running on different services.
        sendIP: true
        # If `sendTimestamp` is true, a timestamp will be added to logs events.
        # Please note that Loggly and Logentries already have a timestamp, so in most
        # cases you can leave this value set to false.
        sendTimestamp: false
        # Change the value of `service` to loggly, logentries or null, depending
        # on which logging service you want to use.
        service: null
        # If you set `service` to loggly, please inform your Loggly subdomain and token.
        Loggly:
            subdomain: null
            token: null
        # If you set `service` to logentries, please inform your Logentries token.
        Logentries:
            token: null

    # TWITTER
    # -------------------------------------------------------------------------
    # If you want to integrate with Twitter, you'll need to register an application
    # at http://dev.twitter.com and set the properties below.
    Twitter:
        # Your OAuth access secret. This can be generated automatically for your
        # account on you application details page.
        accessSecret: null
        # Your OAuth access token. This can be generated automatically for your
        # account on you application details page.
        accessToken: null
        # The Twitter app consumer key.
        consumerKey: null
        # The Twitter app consumer secret.
        consumerSecret: null
        # Inbox check interval, in seconds, default is 120. So will check for incoming
        # direct messages on Twitter every 2 minutes.
        inboxCheckInterval: 120
        # How long to wait before trying to authenticate on Twitter again (in seconds).
        retryInterval: 600
        # Scheduled twitter check interval, in seconds, default is 60. So will check
        # for scheduled twitter messages to be dispatched every minute.
        scheduledCheckInterval: 60
        # If a scheduled twitter update is missed, for how long should it stay "valid"
        # for retries, in minutes? For example if a post for 14:45 is missed, the app
        # has till 14:48 to dispatch it, after that time it will be only deleted.
        # Default value is 3 minutes.
        scheduledAllowedMinutes: 3


# Singleton implementation
# -----------------------------------------------------------------------------
SettingsDefault.getInstance = ->
    @instance = new SettingsDefault() if not @instance?
    return @instance

module.exports = exports = SettingsDefault.getInstance()